<?php
/**
 * Local Active Record
 * @author  <your-name-here>
 */
class Local extends TRecord
{
    const TABLENAME = 'local';
    const PRIMARYKEY= 'id_local';
    const IDPOLICY =  'max'; // {max, serial}
    
    
    private $organograma;

    /**
     * Constructor method
     */
    public function __construct($id = NULL, $callObjectLoad = TRUE)
    {
        parent::__construct($id, $callObjectLoad);
        parent::addAttribute('id_organograma');
        parent::addAttribute('descricao');
        parent::addAttribute('cod_local');
    }

    
    /**
     * Method set_organograma
     * Sample of usage: $local->organograma = $object;
     * @param $object Instance of Organograma
     */
    public function set_organograma(Organograma $object)
    {
        $this->organograma = $object;
        $this->organograma_id = $object->id;
    }
    
    /**
     * Method get_organograma
     * Sample of usage: $local->organograma->attribute;
     * @returns Organograma instance
     */
    public function get_organograma()
    {
        // loads the associated object
        if (empty($this->organograma))
            $this->organograma = new Organograma($this->organograma_id);
    
        // returns the associated object
        return $this->organograma;
    }
    


}
